package game.view.map
{
	import flash.display.Sprite;
	import flash.events.MouseEvent;
	
	import game.define.NotificationNames;
	import game.manager.LayerManager;
	
	import org.puremvc.as3.interfaces.INotification;
	import org.puremvc.as3.patterns.mediator.Mediator;
	
	public class MapMediator extends Mediator
	{
		public static const NAME:String = "MapMediator";
		
		public function MapMediator(mediatorName:String=null, viewComponent:Object=null)
		{
			super(NAME, viewComponent);
			
			inits();
		}
		
		override public function listNotificationInterests():Array
		{
			return [
				NotificationNames.SCENE_SWITCH
			];
		}
		
		override public function handleNotification(notification:INotification):void
		{
			switch (notification.getName())
			{
				case NotificationNames.SCENE_SWITCH:
					
					break;
			}
		}
		
		
		/////////////////////////////////////////////////////////////////////////////
		private var _layer:Sprite = null;
		
		private function inits():void
		{
			_layer = LayerManager.mapLayer;
			_layer.addEventListener(MouseEvent.CLICK, onLayerClick);
		}

		private function onLayerClick():void
		{
			// throw notice
		}
		
		/////////////////////////////////////////////////////////////////////////////
		private var _mapViews:Object = {};
		private function getMapView(mapID:int):MapView
		{
			if (!_mapViews[mapID])
				_mapViews[mapID] = new MapView();
			
			return _mapViews[mapID];
		}
	}
}